package com.ssy.lingxi.order.entity;

import com.fasterxml.jackson.annotation.JsonBackReference;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 订单商品积分抵扣使用记录
 * @author wyx
 * @version 2.0.0
 * @date 2022-03-02
 **/
@Entity
@Table(schema = "public", name = "ord_deduction")
public class OrderDeductionDO implements Serializable {
    private static final long serialVersionUID = -1634279046641621955L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ord_deduction_seq")
    @SequenceGenerator(sequenceName = "ord_deduction_seq", name = "ord_deduction_seq", allocationSize = 1)
    private Long id;

    /**
     * 多对一双向关联订单
     */
    @JsonBackReference
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "order_id")
    private OrderDO order;

    /**
     * 积分归属的供应会员（店铺）Id
     */
    @Column
    private Long vendorMemberId;

    /**
     * 积分归属的供应会员（店铺）角色Id
     */
    @Column
    private Long vendorRoleId;

    /**
     * 供应商会员名称
     */
    @Column(columnDefinition = "varchar(200)")
    private String vendorName;

    /**
     * 积分类型：0=平台；1=会员
     */
    @Column
    private Integer type;

    /**
     * 消费的积分
     */
    @Column
    private Integer usedPoint;

    /**
     * 本单积分可抵扣金额
     */
    @Column(columnDefinition = "numeric")
    private BigDecimal amount;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public OrderDO getOrder() {
        return order;
    }

    public void setOrder(OrderDO order) {
        this.order = order;
    }

    public Long getVendorMemberId() {
        return vendorMemberId;
    }

    public void setVendorMemberId(Long vendorMemberId) {
        this.vendorMemberId = vendorMemberId;
    }

    public Long getVendorRoleId() {
        return vendorRoleId;
    }

    public void setVendorRoleId(Long vendorRoleId) {
        this.vendorRoleId = vendorRoleId;
    }

    public String getVendorName() {
        return vendorName;
    }

    public void setVendorName(String vendorName) {
        this.vendorName = vendorName;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getUsedPoint() {
        return usedPoint;
    }

    public void setUsedPoint(Integer usedPoint) {
        this.usedPoint = usedPoint;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }
}
